// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证（版本 2.0）进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动！任何基于本项目二次开发而产生的一切法律纠纷和责任，我们不承担任何责任！

namespace WCS.Application.Entity.Warehous;
[SugarTable("agvactions", "调度动作表")]
// 唯一索引
[SugarIndex("uk_agvactions", "Id", OrderByType.Asc, true)]
// 查询索引 任务id  动作类型
[SugarIndex("index_agvactions_id_name", "TaskId", OrderByType.Asc, false)]
public class AgvactionsEntity : EntityBaseData
{
    /// <summary>
    /// 自增ID
    /// </summary>
    [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "自增ID")]
    public int Id { get; set; }

    /// <summary>
    /// 任务ID
    /// </summary>
    [MaxLength(64)]
    [SugarColumn(ColumnDescription = "任务ID", Length = 64)]
    [Required(ErrorMessage = "任务ID不能为空")]
    public string TaskId { get; set; }

    /// <summary>
    /// 设备ID
    /// </summary>
    [MaxLength(32)]
    [SugarColumn(ColumnDescription = "设备ID", Length = 32)]
    [Required(ErrorMessage = "设备ID不能为空")]
    public string DeviceId { get; set; }

    /// <summary>
    /// 动作类型
    /// </summary>
    [SugarColumn(ColumnDescription = "动作类型")]
    public AgvActionType ActionType { get; set; }

    /// <summary>
    /// 起始点位
    /// </summary>
    [MaxLength(64)]
    [SugarColumn(ColumnDescription = "起始点位", Length = 64)]
    [Required(ErrorMessage = "起始点位不能为空")]
    public string StartPosition { get; set; }

    /// <summary>
    /// 目标位置
    /// </summary>
    [MaxLength(64)]
    [SugarColumn(ColumnDescription = "目标位置", Length = 64)]
    [Required(ErrorMessage = "目标位置不能为空")]
    public string TargetPosition { get; set; }

    /// <summary>
    /// 状态
    /// </summary>
    [SugarColumn(ColumnDescription = "状态")]
    public ActionStatusEnum Status { get; set; } = ActionStatusEnum.Pending;


    /// <summary>
    /// 动作分组类型
    /// </summary>
    [SugarColumn(ColumnDescription = "动作分组类型")]
    public ActionTypeEnum ActionGroupType { get; set; }
    /// <summary>
    /// 出库入库
    /// </summary>
    [SugarColumn(ColumnDescription = "出库入库", Length = 64)]
    public string Istype { get; set; }

    /// <summary>
    /// 组初始位置
    /// </summary>
    [MaxLength(64)]
    [SugarColumn(ColumnDescription = "组初始位置", Length = 64)]
    public string GroupStartPosition { get; set; }

    /// <summary>
    /// 组目标位置
    /// </summary>
    [MaxLength(64)]
    [SugarColumn(ColumnDescription = "组目标位置", Length = 64)]
    public string GroupTargetPosition { get; set; }
    /// <summary>
    /// 托盘码
    /// </summary>
    [MaxLength(64)]
    [SugarColumn(ColumnDescription = "托盘码", Length = 64)]
    public string Palletcode { get; set; }
    /// <summary>
    /// Agvtaskid 取值 10000-99999
    /// </summary>
    [MaxLength(64)]
    [SugarColumn(ColumnDescription = "Agvtaskid", Length = 64)]
    public int? AgvTaskid { get; set; }
    /// <summary>
    /// 动作经过路线（JSON数组存储）
    /// </summary>
    [MaxLength(64)]
    [SugarColumn(ColumnDescription = "Routepoint", Length = 500)]
    public string Routepoint { get; set; }
    /// <summary>
    /// 动作排序
    /// </summary>
    [SugarColumn(ColumnDescription = "Actionsort")]
    public int Actionsort { get; set; }
    /// <summary>
    /// 楼层
    /// </summary>
    [SugarColumn(ColumnDescription = "TargetFloor")]
    public int? TargetFloor { get; set; }
}

/// <summary>
/// AGV动作类型
/// </summary>
public enum AgvActionType
{
    /// <summary>
    /// 行动指令
    /// </summary>
    [Description("行动")]
    Movement = 0,

    /// <summary>
    /// 反馈信息
    /// </summary>
    [Description("反馈")]
    Feedback = 1
}

/// <summary>
/// 动作分组类型(包含出库入库)
/// </summary>
public enum ActionTypeEnum
{
    /// <summary>
    /// 提升机
    /// </summary>
    [Description("提升机升货")]
    HoistOperationup = 0,

    /// <summary>
    /// 取货
    /// </summary>
    [Description("取货")]
    Pickup = 1,

    /// <summary>
    /// 举货
    /// </summary>
    [Description("举货")]
    Lifting = 2,

    /// <summary>
    /// 送到库位点位
    /// </summary>
    [Description("送到库位点位")]
    StorageDelivery = 3,

    /// <summary>
    /// 卸货
    /// </summary>
    [Description("卸货")]
    Unloading = 4,

    /// <summary>
    /// 送货
    /// </summary>
    [Description("出库送货")]
    Delivery = 5,

    /// <summary>
    /// 提升机
    /// </summary>
    [Description("提升机下货")]
    HoistOperationdown = 6,

    /// <summary>
    /// 入库位
    /// </summary>
    [Description("入库位")]
    InLocation = 7,

    /// <summary>
    /// 出库位
    /// </summary>
    [Description("出库位")]
    OutLocation = 8,
    /// <summary>
    /// 入库位前举货
    /// </summary>
    [Description("入库位前举货")]
    BeforeLifting = 9,
    /// <summary>
    /// 充电
    /// </summary>
    [Description("充电")]
    recharge = 10,

}


/// <summary>
/// 动作状态枚举
/// </summary>
public enum ActionStatusEnum
{
    /// <summary>
    /// 待处理
    /// </summary>
    [Description("待处理")]
    Pending = 0,


    /// <summary>
    /// 已完成
    /// </summary>
    [Description("已完成")]
    Completed = 1,

    /// <summary>
    /// 已失败
    /// </summary>
    [Description("已失败")]
    Failed = 2,

    /// <summary>
    /// 已取消
    /// </summary>
    [Description("已取消")]
    Cancelled = 3
}

